package cn.sdormitory.service.impl;

import cn.sdormitory.service.AppDictDetailService;
import cn.sdormitory.sys.dao.SysDictDetailDao;
import cn.sdormitory.sys.entity.SysDictDetail;
import cn.sdormitory.sys.enums.StatusEnums;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;


@Service
public class AppDictDetailServiceImpl extends ServiceImpl<SysDictDetailDao, SysDictDetail> implements AppDictDetailService {
    @Override
    public List<SysDictDetail> selectDictDataByType(String dictType) {
        return this.list(new LambdaQueryWrapper<SysDictDetail>()
                .eq(SysDictDetail::getDictType, dictType)
                .eq(SysDictDetail::getStatus, StatusEnums.ENABLE.getKey())
                .orderByAsc(SysDictDetail::getDictSort)
        );
    }
}
